document.addEventListener('DOMContentLoaded', () => {
    console.log('Popup.js loaded, sending message to background.js');
    // 通过消息传递与 background.js 通信
    chrome.runtime.sendMessage({ type: 'popup-ready' }, (response) => {
        console.log('Response from background.js:', response);
        if (chrome.runtime.lastError) {
            console.error('Runtime error:', chrome.runtime.lastError.message);
        }
        if (response && response.message) {
            document.getElementById('content').textContent = response.message;
        } else {
            console.error('No valid response from background.js:', response);
        }
    });
});